package jmine.tec.web.wicket.component.command.button;

import jmine.tec.web.wicket.WebWicketMessages;

import org.apache.wicket.Page;

/**
 * @author icaro
 */
public class SaveCommand extends AbstractButtonCommand {

    private final SaveCommandHandler handler;

    /**
     * Construtor
     * 
     * @param handler {@link SaveCommandHandler}
     */
    public SaveCommand(SaveCommandHandler handler) {
        this.handler = handler;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected String getLabel() {
        return WebWicketMessages.BUTTON_SAVE.create().getMessage();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Page execute() {
        this.handler.save();
        return null;
    }
}
